package controlador.accion;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import vistas.AltaFamilia;
import controlador.logica.FamiliaLogica;
import dao.gestion.Familias;

public class FamiliaAccion implements ActionListener {

	private AltaFamilia altaFamilia;

	public FamiliaAccion(AltaFamilia a) {
		this.altaFamilia = a;
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		if (e.getActionCommand().equals("Guardar")) {
			Familias bean = new Familias(altaFamilia.getTxtFamilia().getText(),
					altaFamilia.getTxtADesr().getText());

			FamiliaLogica logica = new FamiliaLogica();
			logica.alta(bean);
			altaFamilia.dispose();
		} else if (e.getActionCommand().equals("Cancelar")) {
			altaFamilia.dispose();
		}

	}

}
